# base image
FROM java:8

# maintainer
MAINTAINER xieyang@dodora.cn

# update packages and install maven

# RUN sed -i 's/http:\/\/archive\.ubuntu\.com\/ubuntu\//http:\/\/mirrors\.163\.com\/ubuntu\//g' /etc/apt/sources.list

# 更新apt-get源 使用163的源
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && \
    echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list && \
    echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list

RUN  \
  export DEBIAN_FRONTEND=noninteractive && \
  #sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \
  apt-get update && \
  apt-get -y upgrade && \
  apt-get install -y vim wget curl maven

# 更改时区
ENV TIME_ZONE Asia/Shanghai
RUN apt-get install tzdata \ 
&& echo "${TIME_ZONE}" > /etc/timezone \ 
&& ln -sf /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime  

# attach volumes
VOLUME /app

# create working directory
RUN mkdir -p /app
WORKDIR /app

# maven exec
CMD ["mvn", "clean", "install", "spring-boot:run"]